<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>mapbox叠加geowebcache发布的arcgis3857坐标</title>
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
    <link href="https://cdn.bootcdn.net/ajax/libs/mapbox-gl/1.9.1/mapbox-gl.css" rel="stylesheet">
    <script src="https://cdn.bootcdn.net/ajax/libs/mapbox-gl/1.9.1/mapbox-gl.js"></script>
    <style>
        body { margin: 0; padding: 0; }
        #map { position: absolute; top: 0; bottom: 0; width: 100%; }
    </style>
</head>
<body>
<div id="map"></div>
<script>
    var mapStyle = {
        "version": 8,
        "name": "Custom Map",
        "sources": {
            "custom-raster": {
                "type": "raster",
                "tiles": ["http://t5.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=cfafaa0d269a0e29688c4482cfae7c64"],
                "tileSize": 256
            }
        },
        "layers": [
            {
                "id": "custom-raster-layer",
                "type": "raster",
                "source": "custom-raster"
            }
        ]

    };
    // mapboxgl.accessToken = 'pk.eyJ1IjoiYWRtaW4tbHVjYXMiLCJhIjoiY2xrcm5jcDFnMGJvMjNmbjNrdWh1dDQ3biJ9.gW0WN4QSSl1EZPmgrhUc0Q';
    const map = new mapboxgl.Map({
        container: 'map', // container ID
        // Choose from Mapbox's core styles, or make your own style with Mapbox Studio
        style: mapStyle, // style URL
        center: [119.0153, 33.6104], // starting position [lng, lat]
        zoom: 10 // starting zoom
    });

    map.on('load', function () {
        map.addSource('geowebcache-source', {
            'type': 'raster',
            'tiles': [
                'http://192.168.1.90:18080/geowebcache/service/wms?LAYERS=huaianblue&FORMAT=image%2Fjpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A3857&BBOX={bbox-epsg-3857}&WIDTH=256&HEIGHT=256'
            ],
            'tileSize': 256
        });

        map.addLayer({
            'id': 'geowebcache-layer',
            'type': 'raster',
            'source': 'geowebcache-source',
            'paint': {}
        });


    });

</script>

</body>
</html>
